import Request from './request.js';

const API = {
	wxLogin: '/auth/app/wx/login',
	wxLogout: '/logout',
	phoneLogin: '/auth/app/wx/login',
	userInfo: '/app/bus/user/user/info',
	userBindBusiness: '/app/bus/burying/point/category',
	smsCode: '/system/utils/sms/code',
	businessList: '/app/bus/guide/category/list',
	uploadIdcardFileback: '/app/bus/utils/idCard/info/back',
	uploadIdcardFilefront: '/app/bus/utils/idCard/info/front',
	realNameAuth: '/app/bus/people/realNameAuthInfo',
	getEToken: '/app/tx/realName/token',
	pushEToken: '/app/bus/people/realName/face',
	wxMobileLogin: '/auth/app/wx/wxMobileLogin',
	wxAppLogin: '/auth/app/wx/wxAppLogin',
	exitLogin: '/auth/app/wx/logout',
	getGuideUser: '/app/bus/guide/user',
	getAvatarList: '/app/bus/avatar/getAvatarList',
	userLogOff: '/app/bus/user/log/off', // 注销账号接口
	acceptOrders: '/app/bus/user/accept/orders', // 接单功能开启/关闭接口


};

// 小程序登录
export const wxLogin = (params) =>
	Request.post(
		API.wxLogin, {}, {
			params
		}
	);

// 微信授权手机号登录（GET，query参数传code和openId ）
export const wxMobileLogin = (params) =>
	Request.get(API.wxMobileLogin, {
		params
	});
// 微信登录
export const wxAppLogin = (params) =>
	Request.get(API.wxAppLogin, {
		params
	});

// 小程序退出登录
export const wxLogout = (params) =>
	Request.post(
		API.wxLogout, {}, {
			params
		}
	);

// 手机号验证码登录
export const phoneLogin = (params) =>
	Request.post(
		API.phoneLogin, {}, {
			data: params
		}
	);

// 用户详情
export const userInfo = (params) => Request.get(API.userInfo, params);

// 发送登录验证码
export const smsCode = (params) =>
	Request.get(API.smsCode, {
		data: params
	});

// 编辑用户（原代码里 API.saveUser 未定义，若实际有需补充 API 定义 ）
export const saveUser = (params) => {
	return Request.post(API.saveUser, params);
};

// 上传身份证文件背面
export const uploadIdcardFileback = API.uploadIdcardFileback;

// 上传身份证文件正面
export const uploadIdcardFilefront = API.uploadIdcardFilefront;

export const uploadFiles = (params) => {
	return Request.upload(API.uploadFiles, params);
};
// 获取业务分类
export const businessList = () => {
	return Request.get(API.businessList);
};

// 绑定业务
export const userBindBusiness = (params) => {
	return Request.post(
		API.userBindBusiness, {}, {
			data: params
		}
	);
};

// 实名认证
export const realNameAuth = (params) => {
	return Request.put(API.realNameAuth, params);
};

// 获取E通行认证token
export const getEToken = () => {
	return Request.get(API.getEToken);
};

// 推送E通行认证token（原函数名和功能若需区分，可结合实际场景调整 ）
export const pushEToken = (params) => {
	return Request.get(API.pushEToken, {
		data: params
	});
};

// 设置页面退出登录
export const exitLogin = () =>
	Request.delete(
		API.exitLogin, {},
	);

// 引导页修改用户信息
export const getGuideUser = data => Request.put(API.getGuideUser, data);

// 获取默认头像列表
export const getAvatarList = () => {
	return Request.get(API.getAvatarList);
};

// 注销账号
export const userLogOff = (params) => {
	return Request.post(
		API.userLogOff, {}, {
			data: params // 参数通过 body 传递
		}
	);
};

// 接单功能开启/关闭状态获取
export const getAcceptOrdersStatus = () => {
	return Request.get(API.acceptOrders);
};